import QtQuick 2.3
import QtQuick.Layouts 1.1
import "qrc:///content"
import "qrc:///Constants.js" as Constants

Rectangle
{
    // Identifier of the item
    id: mainWindow

    // common properties

    //
    anchors.fill: parent
    color: Constants.backgroundColor

    // Testing purpose (Design)
    width: 500
    height: 500

    // caption
    Caption
    {
        id: caption
        label: "Whandgo"
    }

    // add slider
    Rectangle
    {
        id: sliderAdds
        color: "gray"
        anchors.top: caption.bottom
        anchors.horizontalCenter: parent.horizontalCenter
        width: parent.width
        height: parent.height / 3

        // Set appearance properties
        radius: 2
        antialiasing: true
    }

    // grid
    GridLayout
    {
        id: gridLayout
        anchors.bottom: parent.bottom
        anchors.top: sliderAdds.bottom
        anchors.topMargin: 4
        anchors.horizontalCenter: parent.horizontalCenter
        width: parent.width
        // spacing: 1
        columns: 3
        flow: GridLayout.LeftToRight

        Repeater
        {
            id: repeater
            model: 4

            Exhibitor
            {
                id: gridOffers
                // width: 100
                // height: 50 + (index%2? 50 : 0);
                Layout.fillHeight: true
                Layout.fillWidth: true
                Layout.rowSpan: (index%2? 2 : 1);
            }
        }
    }

    // signals

    // functions
    function showView(show)
    {
        mainWindow.state = show? "" : "hide"
    }

    // states
    states:
    [
    State
    {
        name: "hide"
        PropertyChanges
        {
            target: mainWindow
            opacity: 0.0
        }
    }
    ]

    // transitions
    transitions: Transition
    {
        NumberAnimation
        {
            properties: "opacity"
            duration: 500
        }
    }
}
